<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#no").focus();
			$("#inputForm").validate({
				rules: {
					username: {remote: "${ctx}/mms/user/checkLoginName?oldLoginName=" + encodeURIComponent('${mmsUserManagement.username}')}
				},
				messages: {
					username: {remote: "用户登录名已存在"},
					confirmNewPassword: {equalTo: "输入与上面相同的密码"}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/mms/user/list">用户列表</a></li>
		<li class="active"><a href="${ctx}/mms/user/form">新增用户</a></li> 
		
	</ul><br/>
	<form:form id="inputForm" modelAttribute="mmsUserManagement" action="${ctx}/mms/user/save" method="post" class="form-horizontal">
<%-- 		<form:hidden path="id"/> --%>      
  <input type="hidden" name="token" value="${token}" />
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">用户名:</label>
			<div class="controls">
 				<input id="oldName" name="oldName" type="hidden" value="${mmsUserManagement.username}">
  				<form:input path="username" htmlEscape="false" maxlength="50" class="required userName"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">密码:</label>
			<div class="controls">
				<input id="Password" name="Password" type="password" value="${mmsUserManagement.password}" maxlength="50" minlength="3" class="${empty mmsUserManagement.id?'required':''}"/>
 				<c:if test="${empty mmsUserManagement.id}"></c:if>
 			</div>
		</div>
		<div class="control-group">
			<label class="control-label">手机号:</label>
			<div class="controls">
 				<form:input path="mobilePhone" htmlEscape="false" maxlength="20"></form:input>
 			</div>
		</div>	
		<div class="control-group">
			<label class="control-label">姓名:</label>
			<div class="controls">
				<input id="truename" name="truename" type="hidden" value="${mmsUserManagement.username}">
 				<form:input path="truename" htmlEscape="false" maxlength="50" class="required"/>
			</div>
		</div>	
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
<!-- 		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/> -->		
		</div>
	</form:form>
</body>
<script type="text/javascript">
$function(){
	
}
</script>
</html>